package com.txy.service.impl;

import com.txy.dao.UserDao;
import com.txy.dao.impl.UserDaoImpl;
import com.txy.entity.User;
import com.txy.exception.LoginErrorException;
import com.txy.service.UserService;

/**
 * Author：汤小洋
 * Date：2022-11-08 14:04
 * Description：<描述>
 */
public class UserServiceImpl implements UserService {

    UserDao userDao = new UserDaoImpl();

    @Override
    public User login(String username, String password) throws LoginErrorException {
        User user = userDao.selectByUsernameAndPassword(username, password);
        if (user == null){
            throw new LoginErrorException("登陆失败！");
        }
        return user;
    }
}
